<template>
	<view class="white">
		<u-navbar :is-back="false" :border-bottom="false" :background="{ background: '#fff' }">
			<view class="slot u-flex align-center justify-center">
				<view class="cuIcon-back" @click="Back()"></view>
				|
				<navigator url="/pages/index/index" open-type="switchTab" hover-class="other-navigator-hover">
					<view class="cuIcon-home"></view>
				</navigator>
			</view>
		</u-navbar>
		<view class="main">
			<view class="swiper">
				<swiper indicator-active-color="#fff" :autoplay="autoplay" :interval="2000" :duration="500" @change="change"
					style="height: 408rpx;">
					<block v-for="(item,i) in background" :key="i">
						<swiper-item>
							<view class="banner">
								<image src="../../static/images/gongshi-img.png" mode="widthFix"></image>
							</view>
						</swiper-item>
					</block>
				</swiper>
			</view>
			<!-- <image src="../../static/images/gongshi-img.png" mode="aspectFill"></image> -->
			
			<view class="u-flex justify-between text">
				<view class="">
					<view class="name text-bold">
						中华墨坊课程介绍
					</view>
					<view class="u-font-24">
						457人浏览
					</view>
				</view>

			</view>
			<view class="u-flex justify-between fenxian">
				<view class="u-font-36 text-orange">
					免费
				</view>
				<image src="../../static/images/xiangzhi.png" mode="aspectFill" @tap="showModal" data-target="Modal"></image>
			</view>
			<view class="img">
				<view class="u-font-30">
					他们都在逛
				</view>
				<view class="u-flex justify-between ">
					<view class="avatar">
						<image src="../../static/images/avatar.png" mode="aspectFill"></image>
						<image src="../../static/images/banren.png" mode="aspectFill"></image>
						<image src="../../static/images/chanpin.jpg" mode="aspectFill"></image>
						<image src="../../static/images/avatar.png" mode="aspectFill"></image>
						<image src="../../static/images/banren.png" mode="aspectFill"></image>
					</view>
					<button class="cu-btn round bg-orange">
						分享
					</button>
				</view>
			</view>

		</view>
		<u-gap height="20" bg-color="#F1F1F1"></u-gap>
		<view class="tabs">
			<u-tabs :list="list" :is-scroll="false" :current="current" :bold="false" active-color="#CC0001"
				@change="change"></u-tabs>
		</view>
		<u-gap height="20" bg-color="#F1F1F1"></u-gap>
		<view class="u-content" v-if="!current">
			<u-parse :html="content" :tag-style="style"></u-parse>
		</view>
		<view class="u-content nulu" v-else>
			<view class="u-flex justify-between">
				<view class="text-bold u-font-30">
					全部内容(15)
				</view>
				<view class="">
					<image src="../../static/images/daoxv.png" mode="aspectFit"></image>
				</view>
			</view>
			<view class="flex">
				<view class="cu-btn round sm">
					视频
				</view>
				<view class="">
					<view class="u-font-30">
						第一期《丰衣足食》
					</view>
					<view class="u-font-24">
						9:45 | 14次观看
					</view>
				</view>
			</view>
			<view class="flex">
				<view class="cu-btn round sm">
					视频
				</view>
				<view class="">
					<view class="u-font-30">
						第一期《丰衣足食》
					</view>
					<view class="u-font-24">
						9:45 | 14次观看
					</view>
				</view>
			</view>
		</view>
		
		<u-gap height="110"></u-gap>
		<view class="u-flex justify-center bottom">
			<view class="text-center">
				<view class=" u-font-40" :class="collect?'cuIcon-favorfill text-orange':'cuIcon-favor'" @click="djqd"></view>
				<view class="u-font-24">
					收藏
				</view>
			</view>
			<button class="cu-btn u-font-30 bg-orange round" @tap="showModal" data-target="bottomModal">
				免费领取
			</button>
			<button v-if="0" class="cu-btn u-font-30 bg-orange round">
				<text class="cuIcon-lock u-font-30" style="margin-right: 10rpx;"></text>立即购买
			</button>
		</view>
		
		
		<view class="cu-modal bottom-modal" :class="modalName=='bottomModal'?'show':''">
			<view class="cu-dialog">
				<view class="">
					<view class="action" @tap="hideModal">
						<text class="cuIcon-close u-font-40"></text>
					</view>
					<view class="u-font-30">
						请填写报名信息
					</view>
					<view class="u-font-24">
						为了更好地服务你，提交报名信息后即可免费领取课程
					</view>
				</view>
				<u-gap height="25"></u-gap>
				<view class="">
					<view class="cu-form-group">
						<view class="title">学习姓名</view>
						<input class="text-left" placeholder="请输入(必填)" name="input"></input>
					</view>
					<view class="cu-form-group">
						<view class="title">联系人手机</view>
						<input class="text-left" placeholder="请输入(必填)" name="input"></input>
					</view>
					<view class="cu-form-group" @click="show = true">
						<view class="title">学员生日</view>
						<input class="text-left" placeholder-class="placen" disabled placeholder="请选择" name="input"></input>
						<view class="cuIcon-right"></view>
					</view>
					<view class="cu-form-group">
						<view class="title">学员年龄</view>
						<input class="text-left" placeholder-class="placen" disabled placeholder="选择生日后自动计算" name="input"></input>
					</view>
					<view class="cu-form-group justify-start" style="border-bottom: 1px solid #eee;">
						<view class="title">学员性别</view>
						<view class="flex">
							<view class="">
								<text :class="active==0?'cuIcon-roundcheckfill text-orange':'cuIcon-round text-grey'" @click="xianbei(0)"></text>男
							</view>
							<view class="">
								<text :class="active==1?'cuIcon-roundcheckfill text-orange':'cuIcon-round text-grey'" @click="xianbei(1)"></text>女
							</view>
						</view>
					</view>
					<view class="flex u-font-24 shuming">
						提交信息即视为你已同意
						 <navigator class="text-blue" url="" hover-class="none" style="font-size: 24rpx;">
							 个人信息使用授权书
						</navigator>
					</view>
					<button class="cu-btn u-font-30 bg-orange round">
						保存
					</button>
				</view>
			</view>
		</view>
		
		<u-picker v-model="show" mode="time" @confirm="confirm"></u-picker>
		
		<view class="cu-modal share" :class="modalName=='Modal'?'show':''" @tap="hideModal">
				<view class="cu-dialog">
					<view class="baise">
						<view class="top">
							<image src="../../static/images/gongshi-img.png" mode="aspectFill"></image>
							<view class="">
								<view class="name text-bold">
									中华墨坊画材教程
								</view>
								<view class="flex text-bold justify-between text-orange u-font-30">
									免费
								</view>
							</view>
						</view>
						<view class="yitiaoxian">
							<image src="../../static/images/yitiaoxian.jpg" mode="widthFix"></image>
						</view>
						<view class="bottoms flex align-center justify-between">
							<view class="left flex align-center">
								<view class="img">
									<image src="../../static/images/avatar.png" mode="aspectFill"></image>
								</view>
								<view class="">
									<view class="text-bold">
										我的名字
									</view>
									<view class="">
										我的分享码：ru899
									</view>
								</view>
							</view>
							<view class="erwm">
								<image src="../../static/images/erwm.jpg" mode="aspectFit"></image>
							</view>
						</view>
					</view>
					<view class="xiazhi">
						<image src="../../static/images/xiazhi.png" mode="aspectFit"></image>
						<view class="">
							<view class="">长按扫码参与活动或</view>
							 保存到手机相册
						</view>
					</view>
				</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
				autoplay: false,
				show: false,
				
				modalName: null,
				
				collect:false,//收藏
				
				list: [{
					name: '课程介绍'
				}, {
					name: '专栏目录'
				}],
				current: 0,

				content: `
					<p>露从今夜白，月是故乡明露从今夜白，月是故乡明露从今夜白，月是故乡明露从今夜白，月是故乡明露从今夜白，月是故乡明</p>
				`,
				style: {
					// 字符串的形式
					p: 'color: #333;font-size:30rpx;line-height: 44rpx;',
					span: 'font-size: 28rpx'
				},
				active:0
			}
		},
		onLoad() {

		},
		methods: {
			showModal(e) {
				this.modalName = e.currentTarget.dataset.target
			},
			hideModal(e) {
				this.modalName = null
			},
			Back() {
				uni.navigateBack({});
			},
			change(index) {
				this.current = index;
			},
			confirm(data){
				console.log(45454,data)
			},
			xianbei(index){
				this.active = index
			},
			djqd(){
				this.collect = 	!this.collect
			}
		}
	}
</script>

<style lang="scss">
	.swiper {
		position: relative;
	
		.index {
			position: absolute;
			padding: 5rpx 20rpx;
			border-radius: 50rpx;
			bottom: 10rpx;
			right: 10rpx;
			color: #FFFFFF;
			background-color: rgba(0, 0, 0, 0.2);
		}
		.banner {
			image {
				border-radius: 10rpx;
				width: 100%;
				height: 100%;
			}
		}
	}
	.slot{
		margin: 0 10rpx;
		width: 180rpx;
		height: 60rpx;
		border: 2rpx solid #F1F1F1;
		border-radius: 50rpx;
		color: #F1F1F1;
		.cuIcon-back{
			font-size: 40rpx;
			color: #555555;
			margin-right: 20rpx;
		}
		.cuIcon-home{
			font-size: 44rpx;
			color: #555555;
			margin-left: 18rpx;
		}
	}
	.main {
		padding: 35rpx 30rpx 20rpx;
		image {
			width: 690rpx;
			height: 409rpx;
			border-radius: 10rpx;
		}

		.name {
			font-size: 40rpx;
			color: #333333;
		}

		.text {
			margin-top: 30rpx;
			border-bottom: 2rpx solid #f2f2f2;

			.u-font-30 {
				color: #333;
				margin-right: 10rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 2;
			}

			.u-font-24 {
				color: #999;
				margin: 30rpx 0;
			}

		}

		.fenxian {
			margin-top: 20rpx;

			image {
				width: 48rpx;
				height: 46rpx;
			}
		}

		.cu-btn {
			width: 113rpx;
			height: 60rpx;
			font-size: 24rpx;
		}

		.img {
			.u-font-30 {
				padding: 35rpx 0 20rpx;
				color: #666;
			}
			.u-flex{
				position: relative;
				.avatar{
					image{
						position: relative;
					}
					image:nth-child(1){
						left: 0rpx;
						z-index: 10;
					}
					image:nth-child(2){
						left: -20rpx;
						z-index: 9;
					}
					image:nth-child(3){
						left: -40rpx;
						z-index: 8;
					}
					image:nth-child(4){
						left: -60rpx;
						z-index: 7;
					}
					image:nth-child(5){
						left: -80rpx;
						z-index: 6;
					}
				}
				image {
					width: 70rpx;
					height: 70rpx;
					border-radius: 50%;
				}
			}
		}
	}

	.tabs {
		padding: 20rpx 0;
	}
	.u-content{
		padding: 40rpx 30rpx 25rpx;
	}
	.bottom {
		width: 100%;
		position: fixed;
		bottom: 0;
		border-top: 2rpx solid #E8E8E8;
		padding: 15rpx 0;
		background-color: #FFFFFF;
		.cu-btn {
			margin-left: 60rpx;
			width: 520rpx;
			height: 82rpx;
		}
	}
	.nulu{
		.flex{
			margin-top: 50rpx;
		}
		image{
			width: 84rpx;
			height: 30rpx;
		}
		.cu-btn{
			padding: 0 18rpx;
			height: 42rpx;
			margin-right: 20rpx;
			color: #666;
		}
		.u-font-24{
			margin-top: 15rpx;
			color: #999;
		}
	}
	.cu-modal.bottom-modal{
		.cu-dialog{
			border-radius: 50rpx 50rpx 0 0;
			position: relative;
			background-color: #FFFFFF;
			.action{
				position: absolute;
				right: 30rpx;
				top: 28rpx;
				color: #C6C7CA;
			}
			.u-font-30{
				padding: 24rpx 0;
			}
			.u-font-24{
				color: #999;
			}
			.title{
				width: 170rpx;
			}
			.title,.text-left{
				font-size: 26rpx;
			}
			.placen{
				color: #999;
			}
			.justify-start{
				.flex{
					>view{
						margin-right: 80rpx;
					}
				}
				text{
					font-size: 36rpx;
					padding: 0 10rpx;
				}
			}
			.shuming{
				padding: 25rpx;
			}
			.cu-btn{
				margin: 10rpx 0;
				width: 520rpx;
				height: 82rpx;
			}
		}
	}
	.share{
		.cu-dialog{
			background-color: transparent;
			text-align: left;
			width: 520rpx;
			border-radius: 0;
			.baise{
				background-color: #FFFFFF;
			}
			.top{
				padding: 35rpx 35rpx 0;
				image{
					width: 446rpx ;
					height: 446rpx;
					border-radius: 8rpx;
				}
				.name{
					margin-top: 50rpx;
					font-size: 32rpx;
				}
				.flex{
					padding:  16rpx 0;
					text{
						font-size: 30rpx;
					}
				}
			}
			.yitiaoxian{
				width: 100%;
			}
			.bottoms{
				padding: 20rpx 35rpx;
				.left{
					font-size: 24rpx;
					.img{
						margin-right: 20rpx;
					}
					
					image{
						width: 70rpx ;
						height: 70rpx;
						border-radius: 50%;
					}
				}
				.erwm{
					image{
						width: 120rpx ;
						height: 120rpx;
					}
				}
			}
			.xiazhi{
				text-align: center;
				image{
					width: 65rpx ;
					height: 65rpx;
					margin: 10rpx 0;
				}
				font-size: 28rpx;
				color: #FFFFFF;
			}
		}
	}
</style>
